package com.tledu.zrz.model;

public class User {
	private String userName;//用户名
	private String passWord;//密码
	private String nickName;//昵称
	private int age;//年龄
	private String addr;//家庭地址
	
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getPassWord() {
		return passWord;
	}
	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}
	public String getNickName() {
		return nickName;
	}
	public void setNickName(String nickName) {
		this.nickName = nickName;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
	public String getAddr() {
		return addr;
	}
	public void setAddr(String addr) {
		this.addr = addr;
	}
	public void login(User u) {
		/**
		 * 分三种情况 :
		 * 1.用户名 == admin && 密码 == root 输出登录成功
		 * 2.用户名 == admin && 密码 != root 输出密码错误
		 * 3.用户名都不对的情况下不用比较密码
		 * 		即 : 只要不是用户名错误,或者是用户名正确密码错误,就一定是用户不存在
		 */
		if (userName == "admin" && passWord == "root") {
			System.out.println("登录成功!");
		}else if (userName == "admin" && passWord != "root") {
			System.out.println("密码错误!");
		}else {
			System.out.println("用户名不存在!"); 
		}
	}
	//有参的构造方法
	public User(String userName, String passWord, String nickName, int age, String addr) {
		super();
		this.userName = userName;
		this.passWord = passWord;
		this.nickName = nickName;
		this.age = age;
		this.addr = addr;
	}
	//两个参数的构造方法
		public User(String userName, String passWord) {
			super();
			this.userName = userName;
			this.passWord = passWord;
		}
	//无参的构造方法
	public User() {
		super();
		// TODO Auto-generated constructor stub
	}
}
